<template>
  <div class="app-container" style="height: 100vh">
    <form-create :rule="rule" v-model="fApi" :option="options" />
    {{ resultDate }}
  </div>
</template>

<script>
import http from "@/utils/http";
export default {
  // props: {
  //   PAGE_TEMP_STRUCT: {
  //     type: Array,
  //     default: () => {
  //       return [];
  //     },
  //   },
  // },
  data() {
    return {
      resultDate: "",
      fApi: {},
      options: {
        onSubmit: (formData) => {
          //alert(JSON.stringify(formData));
          this.testGet(formData);
        },
      },
      rule: [],
    };
  },
  created() {
    this.load();
  },
  mounted() {},
  methods: {
    async testGet(params) {
      
      let result = await http({
        url: "/ppm/postT",
        data: params,
        method: "POST",
      });
      this.resultDate = result;
    },
    async load() {
      //TODO AJAX去获取this.PAGE【PMM数据库配置记录--页面配置】
      // let PAGE_TEMP_STRUCT = this.PAGE.PAGE_TEMP_STRUCT[0];
      // let PAGE_TEMP_STRUCT_ATTR = PAGE_TEMP_STRUCT.PAGE_TEMP_STRUCT_ATTR;
      // let pageParam = [];
      // for (let i = 0; i < PAGE_TEMP_STRUCT_ATTR.length; i++) {
      //   let param = {};
      //   if (PAGE_TEMP_STRUCT_ATTR[i].ATTR_TYPE_CD == "1") {
      //     param.type = "input";
      //   } else if (PAGE_TEMP_STRUCT_ATTR[i].ATTR_TYPE_CD == "2") {
      //     param.type = "select";
      //     param.options = [
      //       {
      //         value: "104",
      //         label: "生态蔬菜",
      //         disabled: false,
      //       },
      //       {
      //         value: "105",
      //         label: "新鲜水果",
      //         disabled: false,
      //       },
      //     ];
      //   }

      //   param.field = PAGE_TEMP_STRUCT_ATTR[i].ATTR_CD;
      //   param.title = PAGE_TEMP_STRUCT_ATTR[i].ATTR_NAME;

      //   let validates = [];
      //   if (PAGE_TEMP_STRUCT_ATTR[i].VALID_RULE == "empty") {
      //     validates.push({
      //       type: "string",
      //       required: true,
      //       message: "请输入必填项",
      //     });
      //   }
      //   param.validate = validates;
      //   pageParam.push(param);
      // }
      // this.rule = pageParam;
      let result = await http({
        url: "/ppm/getPageConfig",
        params: {tempId:20311},
        method: "GET",
      });
      this.rule=result;
      
    },
  },
};
</script>

<style>
</style>